//
//  VideoModel.m
//  News
//
//  Created by lanou3g on 15/11/5.
//  Copyright © 2015年 songhaowen. All rights reserved.
//

#import "VideoModel.h"

@implementation VideoModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"description"]) {
        self.description_video = value;
    }
    if ([key isEqualToString:@"length"]) {
        self.length_video = value;
    }
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_description_video forKey:@"description_video"];
    [aCoder encodeObject:_length_video forKey:@"length_video"];
    [aCoder encodeObject:_mp4_url forKey:@"mp4_url"];
    [aCoder encodeObject:_playCount forKey:@"playCount"];
    [aCoder encodeObject:_ptime forKey:@"ptime"];
    [aCoder encodeObject:_replyCount forKey:@"replyCount"];
    [aCoder encodeObject:_replyid forKey:@"replyid"];
    [aCoder encodeObject:_title forKey:@"title"];
    [aCoder encodeObject:_vid forKey:@"vid"];
    [aCoder encodeObject:_videosource forKey:@"videosource"];
    [aCoder encodeObject:_cover forKey:@"cover"];
    
    [aCoder encodeFloat:_progress forKey:@"progress"];
    [aCoder encodeBool:_isDownFinished forKey:@"isDownFinished"];
    [aCoder encodeDouble:_videoProgress forKey:@"videoProgress"];
    [aCoder encodeDouble:_videoSize forKey:@"videoSize"];
    [aCoder encodeObject:_videoPath forKey:@"videoPath"];
   
}


- (id)initWithCoder:(NSCoder *)aDecoder
{
    // 当父类实现了NSCoding，就能调用 [super initWithCoder]
    if (self = [super init]) {
        _description_video = [aDecoder decodeObjectForKey:@"description_video"];
        _length_video = [aDecoder decodeObjectForKey:@"length_video"];
        _mp4_url = [aDecoder decodeObjectForKey:@"mp4_url"];
        _playCount = [aDecoder decodeObjectForKey:@"playCount"];
        _ptime = [aDecoder decodeObjectForKey:@"ptime"];
        _replyCount = [aDecoder decodeObjectForKey:@"replyCount"];
        _replyid = [aDecoder decodeObjectForKey:@"replyid"];
        _title = [aDecoder decodeObjectForKey:@"title"];
        _vid = [aDecoder decodeObjectForKey:@"vid"];
        _videosource = [aDecoder decodeObjectForKey:@"videosource"];
        _cover = [aDecoder decodeObjectForKey:@"cover"];
        
        _progress = [aDecoder decodeFloatForKey:@"progress"];
        _isDownFinished = [aDecoder decodeBoolForKey:@"isDownFinished"];
        _videoProgress = [aDecoder decodeDoubleForKey:@"videoProgress"];
        _videoSize = [aDecoder decodeDoubleForKey:@"videoSize"];
        _videoPath = [aDecoder decodeObjectForKey:@"videoPath"];
    }
    
    return self;
}

@end
